﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using KerriganInterface.IServiceClient;
using KerriganDataContract.Customer;
using KerriganDataContract.Authentification;
using KerriganService.DAC;
using KerriganDataContract;

namespace KerriganService.ServiceClient
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ForumService" in code, svc and config file together.
    public class ForumService : IForumService
    {
        public CustomerDC GetCustomer(int id)
        {
            try
            {
                return CustomerDAC.GetCustomer(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }

        public AuthenticateUserDC CheckLoginUser(string nickName, string password)
        {
            try
            {
                return AuthenticationDAC.CheckLoginUser(nickName, password);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public List<vwGetForumCategory> GetCategoryToDisplay()
        {
            try
            {
                return ForumDAC.GetCategoryToDisplay();
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }



        public List<KerriganDataContract.vwGetForumMessage> GetMessageToDisplay(int id)
        {
            try
            {
                return ForumDAC.GetMessageToDisplay(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public AuthenticateUserForumDC CheckLoginUserForum(string nickName, string password)
        {
            try
            {
                return AuthenticationDAC.CheckLoginUserForum(nickName, password);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public void AddCategory(KerriganDataContract.Forum.ForumCategoryDC bo)
        {
            try
            {
                ForumDAC.AddCategory(bo);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public void AddTopicAndMessage(KerriganDataContract.Forum.ForumMessageDC bo)
        {
            try
            {
                ForumDAC.AddTopicAndMessage(bo);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public List<KerriganDataContract.vwGetForumTopicByPerson> GetTopicByPerson(int idTopic,int idPerson)
        {
            try
            {
                return ForumDAC.GetTopicByPerson(idTopic,idPerson);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public KerriganDataContract.Forum.ForumTopicDC GetTopicById(int id)
        {
            try
            {
                return ForumDAC.GetTopicById(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public void UpdateTopic(int id, KerriganDataContract.Forum.ForumDC bo)
        {
            try
            {
                ForumDAC.UpdateTopic(id, bo);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public KerriganDataContract.Forum.ForumCategoryDC GetCategoryById(int id)
        {
            try
            {
                return ForumDAC.GetCategoryById(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public void UpdateCategory(int id, KerriganDataContract.Forum.ForumDC bo)
        {
            try
            {
                ForumDAC.UpdateCategory(id, bo);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public void DeleteCategory(int id)
        {
            try
            {
                ForumDAC.DeleteCategory(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }



        public void DeleteTopic(int id)
        {
            try
            {
                ForumDAC.DeleteTopic(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public void AddMessage(KerriganDataContract.Forum.ForumMessageDC bo)
        {
            try
            {
                ForumDAC.AddMessage(bo);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public KerriganDataContract.Forum.ForumMessageDC GetMessageById(int id)
        {
            try
            {
                return ForumDAC.GetMessageById(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public void UpdateMessage(int id, KerriganDataContract.Forum.ForumDC bo)
        {
            try
            {
                ForumDAC.UpdateMessage(id, bo);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        List<vwGetForumTopic> IForumService.GetTopicToDisplay(int id)
        {
            try
            {
                return ForumDAC.GetTopicToDisplay(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public Boolean DeleteMessage(int id)
        {
            try
            {
                return ForumDAC.DeleteMessage(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }






        public bool AddCustomer(CustomerDC dc)
        {
            try
            {
                return CustomerDAC.AddCustomer(dc);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }



        public void UpdateViews(int id)
        {
            try
            {
                ForumDAC.UpdateViews(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }
    }
}
